﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Modules.guide.actions {
    import flash.events.*;
    import flash.geom.*;
    import Engine.*;

    public class GAWaitForTransactionOrClickGround extends GAWaitForTransaction {

        private function stageClickHandler(_arg1:MouseEvent):void{
            var _local2:Point = new Point(_arg1.stageX, _arg1.stageY);
            var _local3:Point = IsoMath.stageToViewport(_local2);
            var _local4:Array = Global.world.getPickObjects(_local3);
            var _local5:Point = IsoMath.screenPosToTilePos(_local2.x, _local2.y);
            var _local6:Array = Global.world.getCollisionMap().getObjectsByPosition(Math.floor(_local5.x), Math.floor(_local5.y));
            if ((((_local4.length == 0)) && ((_local6.length == 0)))){
                m_seq.stop();
            };
        }
        override public function enter():void{
            super.enter();
            Global.stage.addEventListener(MouseEvent.CLICK, this.stageClickHandler);
        }
        override public function reenter():void{
            super.reenter();
            Global.stage.addEventListener(MouseEvent.CLICK, this.stageClickHandler);
        }
        override public function exit():void{
            super.exit();
            Global.stage.removeEventListener(MouseEvent.CLICK, this.stageClickHandler);
        }
        override public function removed():void{
            super.removed();
            Global.stage.removeEventListener(MouseEvent.CLICK, this.stageClickHandler);
        }

    }
}//package Modules.guide.actions 
